package com.zqu.controller;

import com.zqu.pojo.Order1;
import com.zqu.pojo.OrderDetail;
import com.zqu.service.Order1DetailService;
import com.zqu.service.Order1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("order1")
public class Order1Controller {
    @Autowired
    private Order1Service order1Service;

    @RequestMapping("findorder1")
    @ResponseBody
    public Order1 selectById(){
        return order1Service.selectOrder1ById(1);
    }

    @RequestMapping("selectlist")
    @ResponseBody
    public List<Order1> selectlist(){
        return order1Service.selectList(new Order1());
    }

    @RequestMapping("insertorder1")
    @ResponseBody
    public boolean insert(){
        return order1Service.insertOrder1(new Order1());
    }

    @RequestMapping("updateorder1")
    @ResponseBody
    public boolean update(){
        return order1Service.updateOrder1(new Order1());
    }

    @RequestMapping("deleteorder1")
    @ResponseBody
    public boolean delete(){
        return order1Service.deleteOrder1(1);
    }

    @RequestMapping("deleteorder1byids")
    @ResponseBody
    public boolean deletebyids(){
        String[] ids = {"1","2"};
        return order1Service.deleteOrder1ByIds(ids);
    }
}
